//SpawnCoins(firstX, firstY, firstLength, secondX, secondY, secondLength) 
//Randomly places the next set of coins

// Where do we need to spawn coins
spawnCoins = irandom(3);

if(spawnCoins == 0)//Ground
{
 coinY = global.groundLevel - global.platformHeight;
 coinLength = irandom((argument2 + argument5) / 2);
 coinStart = global.platformOffscreenX + global.platformWidth + irandom(3) * global.platformWidth;
}
else if(spawnCoins == 1)//Platform1
{
 coinStart = argument0;
 coinY = argument1 - global.platformHeight;
 coinLength = irandom(argument2 / 2) + argument2 / 2;
}
else if(spawnCoins == 2)//Platform2
{
 coinStart = argument3;
 coinY = argument4 - global.platformHeight;
 coinLength = irandom(argument5 / 2) + argument5 / 2;
}
else// None
{
 return false;
}  
     
for (i = 0; i < coinLength; i++)
{
 coinX = coinStart + (i * global.platformWidth);
 if(global.ventCount > 0 && ob_roof_vent.x == coinX && ob_roof_vent.y == coinY)
  instance_create(coinX, coinY - global.platformHeight, ob_coin);
 else
  instance_create(coinX, coinY, ob_coin);
}
return true;
      
